import request from '@/utils/request'

// 查询BOM物料列表
export function listItem(query) {
  return request({
    url: '/md/bom/item/list',
    method: 'get',
    params: query
  })
}

// 查询BOM物料详细
export function getItem(id) {
  return request({
    url: '/md/bom/item/' + id,
    method: 'get'
  })
}

// 新增BOM物料
export function addItem(data) {
  return request({
    url: '/md/bom/item',
    method: 'post',
    data: data
  })
}

// 修改BOM物料
export function updateItem(data) {
  return request({
    url: '/md/bom/item',
    method: 'put',
    data: data
  })
}

// 删除BOM物料
export function delItem(id) {
  return request({
    url: '/md/bom/item/' + id,
    method: 'delete'
  })
}

// 根据BOMID查询树形结构
export function listTree(bomId) {
  return request({
    url: '/md/bom/item/tree',
    method: 'get',
    params: {
      bomId: bomId
    }
  })
}

// 根据bomID确认
export function confirmBomItem(data) {
  return request({
    url: '/md/bom/item/push',
    method: 'post',
    data: data
  })
}

// 根据bomID查询已确定的物料
export function getConfirmItem(bomId) {
  return request({
    url: '/md/bom/item/boolean',
    method: 'get',
    params: {
      bomId: bomId
    }
  })
}
